import { createBrowserRouter } from "react-router";
import { lazy } from "react";

const Home = lazy(() => import("../views/Home"));
const Statistics = lazy(() => import("../views/Statistics"));
const About = lazy(() => import("../views/About"));
const Help = lazy(() => import("../views/Help"));
const Layout = lazy(() => import("../layout/Layout"));
const Search = lazy(() => import("../views/Search"));
const NotFound = lazy(() => import("../views/NotFound/NotFound"));

const router = createBrowserRouter([
  {
    path: "/",
    Component: Layout,
    children: [
      {
        index: true,
        Component: Home,
      },
      {
        path: "statistics",
        Component: Statistics,
      },
      {
        path: "about",
        Component: About,
      },
      {
        path: "help",
        Component: Help,
      },
      {
        path: "search",
        Component: Search,
      },
    ],
  },

  {
    path: "*",
    Component: NotFound,
  },
]);

export default router;
